﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class DataBase_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SelecionaCohort();
            configuraConteudoHistory();
        }
    }

    private void SelecionaCohort()
    {
        if (!string.IsNullOrEmpty(Request.QueryString["idUnidade"]))
        {
            Session.Add("cohortAtiva", Request["idUnidade"].ToString());
            Response.Redirect("History.aspx");
        }
        else
        {

            if (Session["cohortAtiva"] != null)
            {
                switch (Session["cohortAtiva"].ToString())
                {
                    case "1":
                        historyBrazil.Visible = true;
                        break;
                    case "3":
                        historyGuatemala.Visible = true;
                        break;
                    case "4":
                        historyIndia.Visible = true;
                        break;
                    case "5":
                        historyPhilippines.Visible = true;
                        break;
                    case "2":
                        historyAfrica.Visible = true;
                        break;
                }
            }
            else
            {
                preHistory.Visible = true;
            }
        }
    }

    private void configuraConteudoHistory()
    {
        historyBrazil.ImageUrl      = "Img/conteudoHistory/history_brazil.jpg";
        historyGuatemala.ImageUrl   = "Img/conteudoHistory/history_guatemala.jpg";
        historyIndia.ImageUrl       = "Img/conteudoHistory/history_india.jpg";
        historyPhilippines.ImageUrl = "Img/conteudoHistory/history_philippines.jpg";
        historyAfrica.ImageUrl      = "Img/conteudoHistory/history_africa.jpg";
        preHistory.ImageUrl         = "Img/conteudoHistory/preHistory.jpg";
    }
}